#!/usr/bin/env bash

REALPATH=$(realpath $0)
WORK_DIR=$(cd $(dirname $REALPATH)/../.. && pwd)

diff ${WORK_DIR}/usr/lib/systemd/system/srs-cloud.service /usr/lib/systemd/system/srs-cloud.service
if [[ $? -ne 0 ]]; then
  cd ${WORK_DIR}/usr/lib/systemd/system &&
  cp -f srs-cloud.service /usr/lib/systemd/system/srs-cloud.service &&
  systemctl daemon-reload &&
  echo "Update systemctl config ok"
  if [[ $? -ne 0 ]]; then echo "Update systemctl config failed"; exit 1; fi
fi

